//
//  SearchDetailViewController.m
//  B段项目
//
//  Created by dllo on 15/9/28.
//  Copyright (c) 2015年 昶博. All rights reserved.
//

#import "SearchDetailViewController.h"
#import "PrefixHeader.pch"

@interface SearchDetailViewController () <UIWebViewDelegate>

@property (nonatomic, assign) NSInteger i;


@end

@implementation SearchDetailViewController

- (void)viewWillAppear:(BOOL)animated
{
    SelfNavBar.hidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self webViewSubviews];
}

- (void)webViewSubviews
{
    UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth , ScreenHeight + ScreenHeight * 70 / 667)];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.webLink]];
    web.scrollView.bounces = NO;
    web.delegate = self;
    web.backgroundColor = [UIColor whiteColor];
    [web loadRequest:request];
    [self.view addSubview:web];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    self.i++;
    [self hideWaiting];
    SelfNavBar.hidden = NO;
    SelfTabBar.hidden = YES;
}

//消除滚动轮指示器
-(void)hideWaiting
{
    [[self.view viewWithTag:9998] removeFromSuperview];
    
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    if (self.i <= 0) {
        return YES;
    }else
        return NO;
}











- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
